package com.zhiyou.crud.service.impl;

import com.zhiyou.crud.bean.Manage;
import com.zhiyou.crud.dao.ManageMapper;
import com.zhiyou.crud.service.ManagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class ManagesServiceImpl implements ManagesService {
    @Autowired
    ManageMapper manageMapper;

    @Override
    public Manage getSelectManage(Manage manage) {
        Example example =new Example(Manage.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo("mname",manage.getMname());
        criteria.andEqualTo("mpassword",manage.getMpassword());
        List<Manage>manages=manageMapper.selectByExample(example);
        if (manages.size() !=0){
            return manages.get(0);
        }
        return null;
    }

    }

